/* 数据字典 */
<!-- create jishenghua-->
<template>
  <a-row :gutter="24">
    <a-col :md="24">
      <a-card :style="cardStyle" :bordered="false">
        <!-- 查询区域 -->
        <div class="table-page-search-wrapper">
          <!-- 搜索区域 -->
          <a-form layout="inline" @keyup.enter.native="searchQuery">
            <a-row :gutter="24">
              <a-col :md="6" :sm="24">
                <a-form-item label="字典类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input placeholder="请输入字典类型" v-model="queryParam.codeType"></a-input>
                </a-form-item>
              </a-col>
              <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
                <a-col :md="6" :sm="24">
                  <a-button type="primary" @click="searchQuery">查询</a-button>
                  <a-button style="margin-left: 8px" @click="searchReset">重置</a-button>
                  <!-- <a @click="handleToggleSearch" style="margin-left: 8px">
                    {{ toggleSearchStatus ? '收起' : '展开' }}
                    <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
                  </a> -->
                </a-col>
              </span>
            </a-row>
          </a-form>
        </div>
        <!-- 操作按钮区域 -->
        <div class="table-operator" style="margin-top: 5px">
          <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
        </div>
        <!-- table区域-begin -->
        <div>
          <a-table
            ref="table"
            size="middle"
            bordered
            rowKey="id"
            :columns="columns"
            :dataSource="dataSource"
            :pagination="ipagination"
            :scroll="scroll"
            :loading="loading"
            :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
            @change="handleTableChange"
          >
            <span slot="action" slot-scope="text, record">
              <a @click="myHandleEdit(record)">编辑</a>
              <a-divider type="vertical" />
              <a-popconfirm title="确定删除吗?" @confirm="() => myHandleDelete(record)">
                <a>删除</a>
              </a-popconfirm>
            </span>
          </a-table>
        </div>
        <!-- table区域-end -->
        <!-- 表单区域 -->
        <DictionaryModel ref="modalForm" @ok="modalFormOk"></DictionaryModel>
        <!-- <bill-detail ref="modalDetail"></bill-detail> -->
        <!-- <HandleSee ref="HandleSee" @ok="modalFormOk"></HandleSee> -->
      </a-card>
    </a-col>
  </a-row>
</template>
<script>
// import SaleOrderModal from './dialog/SaleOrderModal'
// import BillDetail from './dialog/BillDetail'
import DictionaryModel from './modules/DictionaryModel'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
// import { BillListMixin } from './mixins/BillListMixin'
import JDate from '@/components/jeecg/JDate'
import Vue from 'vue'
export default {
  name: 'SaleOrderList',
  mixins: [JeecgListMixin],
  components: {
    JDate,
    DictionaryModel
  },
  data() {
    return {
      // 查询条件
      queryParam: {
        number: '',
        materialParam: '',
        type: '其它',
        subType: '销售订单',
        roleType: Vue.ls.get('roleType'),
        organId: '',
        depotId: '',
        creator: ''
      },
      labelCol: {
        span: 5
      },
      wrapperCol: {
        span: 18,
        offset: 1
      },
      // 表头
      columns: [
        { title: '字典类型', dataIndex: 'codeType', width: 145, align: 'center' },
        { title: '字典键', dataIndex: 'codeKey', width: 145, align: 'center' },
        { title: '字典值', dataIndex: 'codeValue', width: 145, align: 'center' },
        // { title: '状态', dataIndex: 'status', width: 145, align: 'center' },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          width: 150,
          scopedSlots: { customRender: 'action' }
        }
      ],
      url: {
        list: '/generalDict/getList',
        exportXlsUrl: '/systemConfig/static/quotation',
        delete: '/generalDict/delete',
        deleteBatch: '/depotHead/deleteBatch',
        batchSetStatusUrl: '/depotHead/batchSetStatus'
      }
    }
  },
  created() {
    this.initCustomer()
    this.initUser()
  },
  computed: {},
  methods: {
    HandleSee(record) {
      this.$refs.HandleSee.edit(record)
      this.$refs.HandleSee.title = '查看'
      this.$refs.HandleSee.disableSubmit = false
    },
    formateDliveryDate: function(value, dateString) {
      this.queryParam.deliveryDate = dateString
      console.log(this.queryParam)
    },

    myHandleEdit(record) {
      this.$refs.modalForm.action = 'edit'
      this.handleEdit(record)
    },
    myHandleDelete(record) {
      this.handleDelete(record.id)
    }
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
